# Maintainer: Sarah Ottinger

_realname=responses
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.12.0
pkgrel=1
pkgdesc='A utility library for mocking out the `requests` Python library. (mingw-w64)'
arch=('any')
url="https://github.com/getsentry/responses"
license=('Apache')
depends=("${MINGW_PACKAGE_PREFIX}-python-biscuits" "${MINGW_PACKAGE_PREFIX}-python-requests" "${MINGW_PACKAGE_PREFIX}-python-six")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-flake8" "${MINGW_PACKAGE_PREFIX}-python-pytest-cov" "${MINGW_PACKAGE_PREFIX}-python-pytest-localserver" "${MINGW_PACKAGE_PREFIX}-python-pytest-runner")
source=("${_realname}-$pkgver.tar.gz::https://github.com/getsentry/responses/archive/$pkgver.tar.gz")
sha256sums=('4a0932a151c3725f104bd9bb469c7796af1324074aba23a2b5d683beb7de1bde')

prepare() {  
  cd "$srcdir"
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-$pkgver" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"  
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py pytest
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
